package com.tripcube.ai.config;

import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 基础聊天配置类
 * 
 * @author alander
 */
@Configuration
public class BaseChatConfig {
    /**
     * 创建DashScope聊天客户端
     * 
     * @param chatClientBuilder Spring AI提供的聊天客户端构建器
     * @return 配置完成的DashScope聊天客户端
     */
    @Bean
    public ChatClient dashScopeChatClient(ChatClient.Builder chatClientBuilder) {
        return chatClientBuilder
                .defaultSystem("你是一个旅游规划智能助手，请为用户出现提出建议！")
                .defaultAdvisors(new SimpleLoggerAdvisor())
                .defaultOptions(
                        DashScopeChatOptions
                                .builder()
                                .withTopP(0.7)
                                .build()
                )
                .build();
    }
}
